package cn.org.qary.controller.rking.front;

import cn.org.qary.entity.User;
import cn.org.qary.service.trait.rking.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.IOException;

@Controller
@RequestMapping("front_user")
public class FrontUserController {


    @Autowired
    UserService userService;

    @RequestMapping("find")
    public String selectUserById(Integer id,Model model){
        User user = userService.selectById(id);
        model.addAttribute("user",user);
        return "myinfo";
    }

    @RequestMapping("update")
    public String updateUser(User user){
        userService.update(user);
        return "redirect:find?id="+user.getId();
    }

}
